package com.alibaba.citrus.cr.b2b.trade.order.dto.enums;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public enum OrderTypeStatus {

    STANDARD_ORDER_TYPE(1,"标准订单类型"),

    FREE_ORDER_TYPE(2,"免费订单类型"),

    CASH_ORDER_TYPE(3,"现金订单类型");

    private static final Map<Integer, OrderTypeStatus> CODE_MAP = Collections.unmodifiableMap(
            new HashMap<Integer, OrderTypeStatus>() {
                {
                    for (OrderTypeStatus status : OrderTypeStatus.values()) {
                        put(status.getCode(), status);
                    }
                }
            });

    /**
     * 根据枚举 code 获取枚举对象
     */
    public static OrderTypeStatus codeOf(Integer code) {
        return CODE_MAP.get(code);
    }


    /**
     * code
     */
    private Integer code;

    private String desc;

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    OrderTypeStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }


}
